#!/usr/bin/python
# This program prints the CDS features that lie between a given coordinates
# Usage: python checkGenes.py genbankfile.gbf 10000 20000

import sys
import re
from Bio import SeqIO

gbfile = sys.argv[1]
gb = SeqIO.read(gbfile, "genbank")

start = int(sys.argv[2]) 
stop = int(sys.argv[3])

#print "Total number of features = %s" % (len(gb.features))

for index, feat in enumerate(gb.features):
    if feat.type == 'CDS':
        if start < feat.location._start.position < stop and start < feat.location._end.position < stop:
            locustag = feat.qualifiers['locus_tag'][0]
            product = feat.qualifiers['product'][0]
            print locustag + "\t" + product

